package com.example.ovulationperiodtracker.Allactivity;

import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.afollestad.materialdialogs.MaterialDialog;
import com.example.ovulationperiodtracker.databinding.ActivityCycleLenghtBinding;
import com.example.ovulationperiodtracker.utils.JCGSQLiteHelper;
import com.example.ovulationperiodtracker.R;
import com.example.ovulationperiodtracker.model.Settings;
import com.example.ovulationperiodtracker.view.NavigationView;
import com.example.ovulationperiodtracker.view.NoteUtils;
import com.necer.base.BaseActivity;
import com.shawnlin.numberpicker.NumberPicker;

public class CycleLenghtActivity extends BaseActivity<ActivityCycleLenghtBinding> {

    @Override
    protected void onCreated(Bundle savedInstanceState) {

        binding.navigation.setOnClickRightListener(new NavigationView.OnClickRightListener() {
            @Override
            public void onClickRight() {
                save();
            }
        });

        int periodLength = NoteUtils.getPeriodLength();
        binding.numberPicker.setValue(periodLength);

    }

    @Override
    protected ActivityCycleLenghtBinding createBinding(LayoutInflater inflater) {
        return ActivityCycleLenghtBinding.inflate(inflater);
    }




    private void save() {
        int value = binding.numberPicker.getValue();
        NoteUtils.savePeriodLength(value);
        finish();
    }


}
